//
//  downItem.m
//  demo
//
//  Created by james on 15/7/20.
//
//

#import "downItem.h"

@implementation downItem

- (instancetype)init
{
    self = [super init];
    if (self) {
        
    }
    return self;
}
-(void)initRequest{

//    //初始化Documents路径
//    NSString *path = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
//    //初始化临时文件路径
//    NSString *folderPath = [path stringByAppendingPathComponent:@"temp"];
//    //创建文件管理器
//    NSFileManager *fileManager = [NSFileManager defaultManager];
//    //判断temp文件夹是否存在
//    BOOL fileExists = [fileManager fileExistsAtPath:folderPath];
//    
//    if (!fileExists) {//如果不存在说创建,因为下载时,不会自动创建文件夹
//        [fileManager createDirectoryAtPath:folderPath withIntermediateDirectories:YES attributes:nil error:nil];
//    }
//    //初始下载路径
//    NSURL *url = [NSURL URLWithString:book.bookPath];
//    //设置下载路径
//    ASIHTTPRequest *request = [[ASIHTTPRequest alloc] initWithURL:url];
//    //设置ASIHTTPRequest代理
//    request.delegate = self;
//    //初始化保存ZIP文件路径
//    NSString *savePath = [path stringByAppendingPathComponent:[NSString stringWithFormat:@"book_%d.zip",book.bookID]];
//    //初始化临时文件路径
//    NSString *tempPath = [path stringByAppendingPathComponent:[NSString stringWithFormat:@"temp/book_%d.zip.temp",book.bookID]];
//    //设置文件保存路径
//    [request setDownloadDestinationPath:savePath];
//    //设置临时文件路径
//    [request setTemporaryFileDownloadPath:tempPath];
//    //设置进度条的代理,
//    [request setDownloadProgressDelegate:book];
//    //设置是是否支持断点下载
//    [request setAllowResumeForFileDownloads:YES];
//    //设置基本信息
//    [request setUserInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInt:book.bookID],@"bookID",nil]];
//    //添加到ASINetworkQueue队列去下载
//    [netWorkQueue addOperation:request];

}
-(void)abort{

}
-(void)addListen:(DownloadState)state{
    
}
-(void)pause{
}
-(void)resume{
}
-(void)start{

}
@end
